package com.buka.mapper;

import com.buka.pojo.Movie;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface MovieMapper {
    @Insert("insert into t_movie values (null,#{movieName},#{movieImgUrl},#{movieTime},1)")
    int add(Movie movie);

    @Select("select * from t_movie")
    List<Movie> list();

    @Update("update t_movie set movie_state = #{state} where movie_id = #{movieId}")
    int changeForStateById(@Param(("movieId")) int movieId, @Param("state") int state);

    @Select("select * from t_movie where movie_id=#{movieId}")
    Movie getMovieById(int movieId);

    @Select("select  * from t_movie where movie_state =#{i}  ")
    List<Movie> getMovieListByState(int i);

}
